import { S } from '../../s';
import { IPSAppCodeList } from './ipsapp-code-list';
import { IPSAppDEDataSet } from '../dataentity/ipsapp-dedata-set';
import { IPSAppDEField } from '../dataentity/ipsapp-defield';
import { IPSAppDataEntity } from '../dataentity/ipsapp-data-entity';
import { IPSCodeItem } from '../../codelist/ipscode-item';
import { IPSLanguageRes } from '../../res/ipslanguage-res';
import { IPSSysPFPlugin } from '../../res/ipssys-pfplugin';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSAppCodeListImpl
  extends PSModelObjectImpl
  implements IPSAppCodeList
{
  protected beginvaluepsappdefield: IPSAppDEField;
  getBeginValuePSAppDEField(): IPSAppDEField | null {
    return (
      this.beginvaluepsappdefield ||
      (this.beginvaluepsappdefield = this.fillObjectModel(
        S._1,
        this.M.getBeginValuePSAppDEField,
        S._392,
      ) as IPSAppDEField)
    );
  }

  get cacheTimeout(): number {
    return this.M.cacheTimeout != null ? this.M.cacheTimeout : -1;
  }

  get codeListTag(): string {
    return this.M.codeListTag;
  }

  get codeListType(): 'STATIC' | 'DYNAMIC' | 'PREDEFINED' {
    return this.M.codeListType;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get customCond(): string {
    return this.M.customCond;
  }

  protected datapsappdefield: IPSAppDEField;
  getDataPSAppDEField(): IPSAppDEField | null {
    return (
      this.datapsappdefield ||
      (this.datapsappdefield = this.fillObjectModel(
        S._1,
        this.M.getDataPSAppDEField,
        S._2b2,
      ) as IPSAppDEField)
    );
  }

  protected disablepsappdefield: IPSAppDEField;
  getDisablePSAppDEField(): IPSAppDEField | null {
    return (
      this.disablepsappdefield ||
      (this.disablepsappdefield = this.fillObjectModel(
        S._1,
        this.M.getDisablePSAppDEField,
        S._2b3,
      ) as IPSAppDEField)
    );
  }

  get dynaInstMode(): 0 | 1 | 2 {
    return this.M.dynaInstMode;
  }

  get dynaInstTag(): string {
    return this.M.dynaInstTag;
  }

  get dynaInstTag2(): string {
    return this.M.dynaInstTag2;
  }

  get emptyText(): string {
    return this.M.emptyText;
  }

  protected emptytextpslanguageres: IPSLanguageRes;
  getEmptyTextPSLanguageRes(): IPSLanguageRes | null {
    return (
      this.emptytextpslanguageres ||
      (this.emptytextpslanguageres = this.fillObjectModel(
        S._276,
        this.M.getEmptyTextPSLanguageRes,
        S._2b4,
      ) as IPSLanguageRes)
    );
  }

  protected endvaluepsappdefield: IPSAppDEField;
  getEndValuePSAppDEField(): IPSAppDEField | null {
    return (
      this.endvaluepsappdefield ||
      (this.endvaluepsappdefield = this.fillObjectModel(
        S._1,
        this.M.getEndValuePSAppDEField,
        S._393,
      ) as IPSAppDEField)
    );
  }

  protected iconclspsappdefield: IPSAppDEField;
  getIconClsPSAppDEField(): IPSAppDEField | null {
    return (
      this.iconclspsappdefield ||
      (this.iconclspsappdefield = this.fillObjectModel(
        S._1,
        this.M.getIconClsPSAppDEField,
        S._2b5,
      ) as IPSAppDEField)
    );
  }

  protected iconclsxpsappdefield: IPSAppDEField;
  getIconClsXPSAppDEField(): IPSAppDEField | null {
    return (
      this.iconclsxpsappdefield ||
      (this.iconclsxpsappdefield = this.fillObjectModel(
        S._1,
        this.M.getIconClsXPSAppDEField,
        S._2b6,
      ) as IPSAppDEField)
    );
  }

  protected iconpathpsappdefield: IPSAppDEField;
  getIconPathPSAppDEField(): IPSAppDEField | null {
    return (
      this.iconpathpsappdefield ||
      (this.iconpathpsappdefield = this.fillObjectModel(
        S._1,
        this.M.getIconPathPSAppDEField,
        S._2b7,
      ) as IPSAppDEField)
    );
  }

  protected iconpathxpsappdefield: IPSAppDEField;
  getIconPathXPSAppDEField(): IPSAppDEField | null {
    return (
      this.iconpathxpsappdefield ||
      (this.iconpathxpsappdefield = this.fillObjectModel(
        S._1,
        this.M.getIconPathXPSAppDEField,
        S._2b8,
      ) as IPSAppDEField)
    );
  }

  get incBeginValueMode(): 0 | 1 | 2 | 3 {
    return this.M.incBeginValueMode != null ? this.M.incBeginValueMode : 0;
  }

  get incEndValueMode(): 0 | 1 | 2 | 3 {
    return this.M.incEndValueMode != null ? this.M.incEndValueMode : 0;
  }

  get minorSortDir(): 'ASC' | 'DESC' {
    return this.M.minorSortDir;
  }

  protected minorsortpsappdefield: IPSAppDEField;
  getMinorSortPSAppDEField(): IPSAppDEField | null {
    return (
      this.minorsortpsappdefield ||
      (this.minorsortpsappdefield = this.fillObjectModel(
        S._1,
        this.M.getMinorSortPSAppDEField,
        S._2b9,
      ) as IPSAppDEField)
    );
  }

  get orMode(): 'NUMBERORMODE' | 'STRINGORMODE' {
    return this.M.orMode;
  }

  protected psappdedataset: IPSAppDEDataSet;
  getPSAppDEDataSet(): IPSAppDEDataSet | null {
    if (this.psappdedataset != null) return this.psappdedataset;
    const value = this.M.getPSAppDEDataSet;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getPSAppDataEntity();
    if (ipsappdataentity != null) {
      this.psappdedataset = ipsappdataentity.findPSAppDEDataSet(value);
    }
    return this.psappdedataset;
  }

  protected psappdataentity: IPSAppDataEntity;
  getPSAppDataEntity(): IPSAppDataEntity | null {
    return (
      this.psappdataentity ||
      (this.psappdataentity = this.fillObjectModel(
        S._f,
        this.M.getPSAppDataEntity,
        S._2aa,
      ) as IPSAppDataEntity)
    );
  }

  protected pscodeitems: IPSCodeItem[];
  getPSCodeItems(): IPSCodeItem[] | null {
    return (
      this.pscodeitems ||
      (this.pscodeitems = this.fillChildListModel(
        this.M.getPSCodeItems,
        S._91,
      ) as IPSCodeItem[])
    );
  }

  findPSCodeItem(objKey: any): IPSCodeItem | null {
    return this.getPSModel5(
      S._91,
      this.getPSCodeItems(),
      objKey,
    ) as IPSCodeItem;
  }

  getPSCodeListTemplId(): string {
    return this.M.getPSCodeListTemplId;
  }

  protected pssyspfplugin: IPSSysPFPlugin;
  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    return (
      this.pssyspfplugin ||
      (this.pssyspfplugin = this.fillObjectModel(
        S._27c,
        this.M.getPSSysPFPlugin,
        S._2a7,
      ) as IPSSysPFPlugin)
    );
  }

  protected pvaluepsappdefield: IPSAppDEField;
  getPValuePSAppDEField(): IPSAppDEField | null {
    return (
      this.pvaluepsappdefield ||
      (this.pvaluepsappdefield = this.fillObjectModel(
        S._1,
        this.M.getPValuePSAppDEField,
        S._2ba,
      ) as IPSAppDEField)
    );
  }

  get predefinedType():
    | 'OPERATOR'
    | 'RUNTIME'
    | 'MODULEINST'
    | 'DEMAINSTATE'
    | 'USER'
    | 'USER2'
    | 'USER3'
    | 'USER4' {
    return this.M.predefinedType;
  }

  get refFlag(): boolean {
    return this.M.refFlag;
  }

  get systemTag(): string {
    return this.M.systemTag;
  }

  protected textpsappdefield: IPSAppDEField;
  getTextPSAppDEField(): IPSAppDEField | null {
    return (
      this.textpsappdefield ||
      (this.textpsappdefield = this.fillObjectModel(
        S._1,
        this.M.getTextPSAppDEField,
        S._2bb,
      ) as IPSAppDEField)
    );
  }

  get textSeparator(): string {
    return this.M.textSeparator;
  }

  get userData(): string {
    return this.M.userData;
  }

  get userData2(): string {
    return this.M.userData2;
  }

  protected valuepsappdefield: IPSAppDEField;
  getValuePSAppDEField(): IPSAppDEField | null {
    return (
      this.valuepsappdefield ||
      (this.valuepsappdefield = this.fillObjectModel(
        S._1,
        this.M.getValuePSAppDEField,
        S._2bc,
      ) as IPSAppDEField)
    );
  }

  get valueSeparator(): string {
    return this.M.valueSeparator;
  }

  get codeItemValueNumber(): boolean {
    return this.M.codeItemValueNumber != null
      ? this.M.codeItemValueNumber
      : false;
  }

  get enableCache(): boolean {
    return this.M.enableCache != null ? this.M.enableCache : false;
  }

  get moduleInstCodeList(): boolean {
    return this.M.moduleInstCodeList != null
      ? this.M.moduleInstCodeList
      : false;
  }

  get subSysAsCloud(): boolean {
    return this.M.subSysAsCloud != null ? this.M.subSysAsCloud : false;
  }

  get subSysCodeList(): boolean {
    return this.M.subSysCodeList != null ? this.M.subSysCodeList : false;
  }

  get thresholdGroup(): boolean {
    return this.M.thresholdGroup != null ? this.M.thresholdGroup : false;
  }

  get userScope(): boolean {
    return this.M.userScope != null ? this.M.userScope : false;
  }
  get cls(): string {
    return 'PSAppCodeListImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._8 || cls == S._9) return true;
    return super.instanceof(cls);
  }
}
